package com.wannengbang.cloudleader.homepage;

import android.os.Bundle;
import android.widget.TextView;

import com.wannengbang.cloudleader.R;
import com.wannengbang.cloudleader.base.BaseActivity;
import com.wannengbang.cloudleader.bean.QueryOrderListBean;
import com.wannengbang.cloudleader.utils.DateTimeUtil;
import com.wannengbang.cloudleader.utils.NumberFormatUtils;
import com.wannengbang.cloudleader.widget.AppTitleBar;

import java.util.Date;

import butterknife.BindView;
import butterknife.ButterKnife;

public class TransactionQueryDetailsActivity extends BaseActivity {


    @BindView(R.id.title_bar)
    AppTitleBar titleBar;
    @BindView(R.id.tv_order_no)
    TextView tvOrderNo;
    @BindView(R.id.tv_agent_name)
    TextView tvAgentName;
    @BindView(R.id.tv_device_unify_no)
    TextView tvDeviceUnifyNo;
    @BindView(R.id.tv_tran_mode)
    TextView tvTranMode;
    @BindView(R.id.tv_order_fee)
    TextView tvOrderFee;
    @BindView(R.id.tv_into_time)
    TextView tvIntoTime;
    @BindView(R.id.tv_create_time)
    TextView tvCreateTime;
    @BindView(R.id.tv_pay_time)
    TextView tvPayTime;
    @BindView(R.id.tv_fee)
    TextView tvFee;
    @BindView(R.id.tv_mem_name)
    TextView tvMemName;
    @BindView(R.id.tv_mem_no)
    TextView tvMemNo;
    @BindView(R.id.tv_card_no)
    TextView tvCardNo;
    @BindView(R.id.tv_fee_rate)
    TextView tvFeeRate;
    private QueryOrderListBean.DataBean.ItemListBean itemListBean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transaction_query_details);
        ButterKnife.bind(this);
        initView();
    }

    public void initView() {
        itemListBean = (QueryOrderListBean.DataBean.ItemListBean) getIntent().getSerializableExtra("itemListBean");
        if (itemListBean != null) {
            tvAgentName.setText(itemListBean.getAgent_name());
            tvOrderNo.setText(itemListBean.getOrder_no());
            tvDeviceUnifyNo.setText(itemListBean.getSn_no());

            tvTranMode.setText(itemListBean.getTrans_type_text());
            String order_fee = NumberFormatUtils.formatTwoDecimal(Double.parseDouble(itemListBean.getOrder_fee()) / 100);
            tvOrderFee.setText(order_fee + "元");
            tvFee.setText(itemListBean.getFee() + "元");
            tvCardNo.setText(itemListBean.getCard_no());
            tvMemName.setText(itemListBean.getMem_name());
            tvMemNo.setText(itemListBean.getMem_no());
            tvFeeRate.setText(itemListBean.getDevice_rate() + "%");
            tvIntoTime.setText(itemListBean.getTrans_type_flag());
            tvCreateTime.setText(DateTimeUtil.format7(new Date(Long.parseLong(itemListBean.getCreate_time()) * 1000)));
            tvPayTime.setText(DateTimeUtil.format7(new Date(Long.parseLong(itemListBean.getPay_time()) * 1000)));
        }
    }
}
